/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2025-01-14
 * Time: 10:48
 */
class Solution2 {
    public boolean isAnagram(String s, String t) {
        int n = s.length() , m = t.length();
        if(n != m) return false;
        int[] nums1 = new int[26];

        for(int i = 0 ; i < s.length() ; i++){
            int index = s.charAt(i)- 'a';
            nums1[index]++;
        }
        for(int i = 0 ; i < t.length() ; i++){
            int index = t.charAt(i)- 'a';
            nums1[index]--;
            if(nums1[index] < 0) return false;
        }
        return true;
    }
}
public class Test2 {
}
